import request from '@/utils/request'

// 查询照度设备列表
export function getIlluminanceDeviceList(query) {
  return request({
    url: '/archives/illuminance/list',
    method: 'get',
    params: query
  })
}

// 查询照度设备详细
export function getIlluminanceDevice(deviceId) {
  return request({
    url: '/archives/illuminance/' + deviceId,
    method: 'get'
  })
}

// 新增照度设备
export function addIlluminanceDevice(data) {
  return request({
    url: '/archives/illuminance',
    method: 'post',
    data: data
  })
}

// 修改照度设备
export function updateIlluminanceDevice(data) {
  return request({
    url: '/archives/illuminance',
    method: 'put',
    data: data
  })
}

// 删除照度设备
export function delIlluminanceDevice(deviceId) {
  return request({
    url: '/archives/illuminance/' + deviceId,
    method: 'delete'
  })
}

// 导出照度设备
export function exportIlluminanceDevice(query) {
  return request({
    url: '/archives/illuminance/export',
    method: 'get',
    params: query
  })
}

// 获取照度实时数据
export function getIlluminanceRealTimeData(deviceId) {
  return request({
    url: '/archives/illuminance/realtime/' + deviceId,
    method: 'get'
  })
}

// 获取照度历史数据
export function getIlluminanceHistoryData(query) {
  return request({
    url: '/archives/illuminance/history',
    method: 'get',
    params: query
  })
}

// 获取照度报警日志
export function getIlluminanceAlarmLogs(query) {
  return request({
    url: '/illuminance/transmitter/logs',
    method: 'get',
    params: query
  })
}

// 获取照度设备管理信息
export function getIlluminanceDeviceManage(query) {
  return request({
    url: '/illuminance/device/manage',
    method: 'get',
    params: query
  })
}

// 设备控制 - 开启/关闭
export function controlIlluminanceDevice(deviceId, action) {
  return request({
    url: '/archives/illuminance/control',
    method: 'post',
    data: {
      deviceId: deviceId,
      action: action
    }
  })
}

// 设备参数配置
export function configIlluminanceDevice(data) {
  return request({
    url: '/archives/illuminance/config',
    method: 'post',
    data: data
  })
}

// 获取设备参数配置
export function getIlluminanceDeviceConfig(deviceId) {
  return request({
    url: '/archives/illuminance/config/' + deviceId,
    method: 'get'
  })
}

// 设备状态统计
export function getIlluminanceDeviceStats() {
  return request({
    url: '/archives/illuminance/stats',
    method: 'get'
  })
}